/**
 * File: reducer.ts
 * Project: reactssr
 * Created Date: Wednesday 2018/01/03 10:53:39
 * Author: zhengjiang
 * -----
 * Last Modified: Thursday 2018/01/04 13:46:43
 * Modified By: zhengjiang
 * -----
 * Description: 
 * 
 */

import { handleActions } from 'redux-actions';
import { indexActions } from './action';
import { IActionPayload } from '../index';

/* state定义 */
export interface IIndexState {
    count:number
}

/* state初始值 */
export const indexInitState:IIndexState = {
	count: 10
};

const reducer = handleActions(
	{
		[indexActions.updateCount as any](state, { payload }: IActionPayload) {
			return { ...state, ...payload };
		}
	},
	indexInitState
);

export const indexReducer = { index: reducer };
